Skip to content

[otel] Expose logging for OTEL #29553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ch99q opened this issue Jun 1, 2025 · 2 comments
Open

[otel] Expose logging for OTEL #29553

ch99q opened this issue Jun 1, 2025 · 2 comments

Comments

@ch99q
Copy link

ch99q commented Jun 1, 2025

I’ve noticed that the internal function op_otel_log already exists in Deno, but it isn’t exposed through the public API. Right now, if we want to send structured logs to OpenTelemetry, we have to funnel everything through console.log, which adds unnecessary overhead and can significantly slow down our applications. It would be very helpful to have a dedicated, public-facing API (or module) that wraps op_otel_log so we can emit logs directly into OTEL without relying on the console.

This change would reduce performance penalties, give us finer control over log format and context, and make it easier to integrate Deno with existing observability pipelines.

@ch99q
Copy link
Author

ch99q commented Jun 1, 2025

Ideally, we’d expose telemetry logging in a standardized way, perhaps through something like @std/log or a new @std/telemetry module. In the meantime, it would be valuable to surface a native logging interface directly on the Deno.telemetry namespace.

One option is to expose a simple Deno.telemetry.log(message, level) function that directly calls the existing internal otelLog (see the implementation at telemetry.ts#L1182). From there, a standard library module @std/telemetry could wrap Deno.telemetry.log behind a familiar logger API (for example, providing logger.info, logger.warn, logger.debug, and logger.error methods).

Alternatively, we could skip creating a separate std-lib package and simply add a Deno.telemetry.getLogger() method. That way, consumers could call Deno.telemetry.getLogger().info("…") (or warn, debug, error) directly without needing an extra import. Either approach would give application authors a consistent, low-overhead way to emit OpenTelemetry-style logs without falling back to console.log.

@marvinhagemeister
Copy link
Contributor

The current approach is to use the official otel package for this: npm:@opentelemetry/api. There is a section about this on the OpenTelemetry page in the docs https://docs.deno.com/runtime/fundamentals/open_telemetry/#user-metrics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants